package web.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import web.jdbc.DBPool;
import web.jdbc.DBPropertiesScan;
import web.operator.EntityOperator;
/**初始化数据库连接和Entity对象
 * @author 乐渊
 * @version 1.0
 * @see DBPropertiesScan
 * @see EntityOperator
 * @see DBPool
 * */
public class DataSourceServlet extends HttpServlet{

	/**
	 */
	private static final long serialVersionUID = 1L;

	public static EntityOperator EO = null;
	
	/**初始化数据库所有相关操作。
	 * @throws ServletException 异常
	 * */
	@Override
	public void init() throws ServletException {
		super.init();
		String DBFile = getInitParameter("DB");
		new DBPropertiesScan(DBFile);//扫描数据库配置
		new DBPool().initPool();//初始化数据库连接
		EO = new EntityOperator();
	}
	
}
